<?php
     $id=$_POST['id'];
     $username=$_POST['username'];
	 $password=$_POST['password'];
	 $status=$_POST['status'];
	 $connection=mysql_connect("localhost","root","192510");
	 mysql_select_db("news",$connection);
	 if($id==null){
		 if($username!=null&&$password!=null){
			   $sql="insert into user(username,password,status) value('$username','$password',$status)";
	           mysql_query($sql);
			   echo "<script>location='select_user.php';</script>";
		 }else{
			    echo "<script>location='insert_user.php';</script>";
		 }
			   
		 
	 }else{
		
		 $sql="update user set username='$username',password='$password',status='$status' where id=$id";
	     mysql_query($sql);
		 if($status==1){
			  echo "<script>location='select_user.php';</script>";
			 
		 }else{
			 
			  echo "<script>location='select_user.php';</script>";
			 
		 }
		
     } 
?>
